import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return routerPush.call(this, location).catch(error => error)
}

const routes = [
  {
    path: '/',
    name: 'home',
    redirect: '/modelLightweight',
    component: () => import('@/views/home.vue'),
    children: [
      {
        path: 'modelLightweight',
        name: '模型轻量化',
        component: () => import('@/views/modelLightweight/index.vue')
      },
      {
        path: 'visualization',
        name: '可视化与质检',
        component: () => import('@/views/visualization/index.vue')
      },
      {
        path: 'demHandle',
        name: 'DEM切片压缩',
        component: () => import('@/views/modelLightweight/demHandle.vue')
      },
      {
        path: 'domHandle',
        name: 'DOM切片压缩',
        component: () => import('@/views/modelLightweight/domHandle.vue')
      },
      {
        path: 'osgbTo3dtiles',
        name: 'osgb转3dtiles',
        component: () => import('@/views/modelLightweight/osgbTo3dtiles.vue')
      },
      {
        path: 'whiteMold',
        name: '矢量转白模',
        component: () => import('@/views/modelLightweight/whiteMold.vue')
      },
      {
        path: 'beCommonModel',
        name: '通用模型转换',
        component: () => import('@/views/modelLightweight/beCommonModel.vue')
      },
      {
        path: 'objTo3dtiles',
        name: '模型转3dtiles',
        component: () => import('@/views/modelLightweight/objTo3dtiles.vue')
      },
      {
        path: 'pointCloud',
        name: '点云切片',
        component: () => import('@/views/modelLightweight/pointCloud.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
